<?php $this->_extends('_layouts/fullpage_layout'); ?>

<?php $this->_block('contents'); ?>

<div id="books-list">

  <?php
  $count = count($books);
  $n = 0;
  foreach ($books as $book):
      $n++;
      $path = "{$root_dir}/{$book['name']}/book-index.php";
      if (!is_file($path)) continue;
  ?>

  <div class="book-index<?php if ($n == $count): ?> last<?php endif; ?>">

    <?php include $path; ?>

    <div class="book-links">
      <ul>
        <li><a href="<?php echo url('docs/page', array('name' => $book['name'])); ?>" class="mime-html">在线阅读</a></li>

        <?php if (isset($book['downloads'])): foreach ((array)$book['downloads'] as $download): ?>

        <li><a href="<?php echo h($download['url']); ?>" class="<?php echo $download['mime']; ?>"><?php echo h($download['title']); ?></a></li>
        <?php endforeach; endif; ?>

      </ul>
    </div>

  </div>

  <?php endforeach; ?>

</div>

<?php $this->_endblock(); ?>

